package com.self;

import com.banyuan.IOUtilis;

import java.io.*;

public class OutputWriteTest {
    public static void main(String[] args) {
        OutputStream os = null;
        OutputStreamWriter osw = null;

        try {
            os = new FileOutputStream("/Users/edy/Desktop/file/1.txt",true);
            osw = new OutputStreamWriter(os,"UTF-8");
            osw.write("我是中国人");
            osw.write("我是中国人");
            osw.write("我是中国人");
            osw.write("我是中国人");
            osw.write("我是中国人");
            osw.write("我是中国人");
            osw.write("我是中国人");
            osw.flush(); // 一次写入

        } catch (FileNotFoundException | UnsupportedEncodingException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            IOUtilis.closeQuiety(os);
            IOUtilis.closeQuiety(osw);

        }
    }
}
